import { Button as AntdButton } from 'antd';
import {CommonComponentProps} from "../../../components/editor/interface.ts";
import {useDrag} from "react-dnd";
import {CSSProperties} from "react";


export interface ButtonProps extends CommonComponentProps {
    id: number;
    name: string;
    parentId?: number;
    styles?: CSSProperties;
    children?: any;
    type:"text" | "link" | "default" | "primary" | "dashed" | undefined
    text:string
}

const Button = ({id, type, text,styles}: ButtonProps) => {
    const [_,drag] = useDrag({
        type:'Button',
        item:{
            type:'Button',
            id,
            dragType:"move"
        }
    })
    return (
        <AntdButton ref={drag} data-component-id={id} type={type} style={styles}>{text}</AntdButton>
    )
}

export default Button;
